//
// Notes to End Users.
//
// The workflow should run without editing this configuration file,
// however there may be instances in which you wish to edit this
// file for compute performance or other reasons. Please see:
//
//   https://nextflow.io/docs/latest/config.html#configuration
//
// for further help editing this file.

params {
    help = false
    version = false
    fastq = null
    bam = null
    spaceranger_bam = null
    adapter_configs = null
    out_dir = "output"
    sample_sheet = null
    sample = null
    single_cell_sample_sheet = null
    aws_image_prefix = null
    aws_queue = null
    disable_ping = false
    kit_config = null
    kit = null
    threads = 8
    full_length_only = true
    min_read_qual = null

    fastq_chunk = 1000000
    barcode_adapter1_suff_length = 10
    barcode_min_quality = 15
    barcode_max_ed = 2
    barcode_min_ed_diff = 2
    gene_assigns_minqv = 30
    matrix_min_genes = 200
    matrix_min_cells = 3
    matrix_max_mito = 20
    matrix_norm_count = 10000
    genes_of_interest = null
    umap_n_repeats = 3
    expected_cells = null
    estimate_cell_count = true
    mito_prefix = "MT-"
    stringtie_opts = "-c 2"
    call_variants = false
    report_variants = null
    call_fusions = false

    ref_genome_dir = null
    ctat_resources = null
    epi2me_resource_bundle = null

    monochrome_logs = false
    validate_params = true
    show_hidden_params = false
    schema_ignore_params = 'show_hidden_params,validate_params,monochrome_logs,aws_queue,aws_image_prefix,wf,resource_bundles'
    store_dir = "wf-single-cell_resources"

    resource_bundles = [
        'gex-GRCh38-2024-A': [
            '10x': 'https://ont-exd-int-s3-euwst1-epi2me-labs.s3.amazonaws.com/wf-single-cell/refdata-gex-GRCh38-2024-A.tar.gz',
            'ctat-lr-fusion': 'https://ont-exd-int-s3-euwst1-epi2me-labs.s3.amazonaws.com/wf-single-cell/ctat_genome_lib_10x_2024.tar.gz'
        ],
         'gex-GRCh38-2024-A_chr_20-21': [
            '10x': 'https://ont-exd-int-s3-euwst1-epi2me-labs.s3.amazonaws.com/wf-single-cell/refdata-gex-GRCh38-2024-A_chr20_21.tar.gz',
            'ctat-lr-fusion': 'https://ont-exd-int-s3-euwst1-epi2me-labs.s3.amazonaws.com/wf-single-cell/ctat_genome_lib_chr20_21_UyHq1cFI.tar.gz'
        ]
    ]

    wf {
        example_cmd = [
            "--expected_cells 100",
            "--fastq 'wf-single-cell-demo/chr17.fq.gz'",
            "--kit '3prime:v3'",
            "--ref_genome_dir 'wf-single-cell-demo'",
            "--genes_of_interest 'wf-single-cell-demo/umap_plot_genes.csv'",
        ]
        merge_threads = 24
        fusion_threads = 12
        container_sha = "shab5b0dea0efc4685f74c8b4f91c979c587e23a020"
        common_sha = "sha1c69fd30053aad5d516e9567b3944384325a0fee"
    }
}

manifest {
    name            = 'epi2me-labs/wf-single-cell'
    author          = 'Oxford Nanopore Technologies'
    homePage        = 'https://github.com/epi2me-labs/wf-single-cell'
    description     = 'Identification of cell- and UMI barcodes from single-cell sequencing.'
    mainScript      = 'main.nf'
    nextflowVersion = '>=23.04.2'
    version         = '3.3.0'
}

epi2melabs {
    tags = 'wf-single-cell,transcriptomics,human,mouse'
    icon = 'faCircle'
}

// used by default for "standard" (docker) and singularity profiles,
// other profiles may override.
process {
    withLabel:singlecell {
        container = "ontresearch/wf-single-cell:${params.wf.container_sha}"
    }
    withLabel:wf_common {
		container = "ontresearch/wf-common:${params.wf.common_sha}"
	}
    withLabel:ctat_lr_fusion {
        container = "trinityctat/ctat_lr_fusion:1.1.0"
    }
    shell = ['/bin/bash', '-euo', 'pipefail']
}


profiles {
    // the "standard" profile is used implicitely by nextflow
    // if no other profile is given on the CLI
    standard {
        docker {
            enabled = true
            // this ensures container is run as host user and group, but
            //    also adds host user to the within-container group
            runOptions = "--user \$(id -u):\$(id -g) --group-add 100"
        }
    }

    // using singularity instead of docker
    singularity {
        singularity {
            enabled = true
            autoMounts = true
        }
    }

    conda {
		conda.enabled = true
	}

    // Using AWS batch.
    // May need to set aws.region and aws.batch.cliPath
    awsbatch {
        process {
            executor = 'awsbatch'
            queue = "${params.aws_queue}"
            memory = '8G'
            withLabel:singlecell {
                container = "${params.aws_image_prefix}-wf-single-cell:${params.wf.container_sha}"
            }
            withLabel:wf_common {
				container = "${params.aws_image_prefix}-wf-common:${params.wf.common_sha}"
			}
            shell = ['/bin/bash', '-euo', 'pipefail']
        }
    }

    // local profile for simplified development testing
    local {
        process.executor = 'local'
    }
}


timeline {
  enabled = true
  overwrite = true
  file = "${params.out_dir}/execution/timeline.html"
}
report {
  enabled = true
  overwrite = true
  file = "${params.out_dir}/execution/report.html"
}
trace {
  enabled = true
  overwrite = true
  file = "${params.out_dir}/execution/trace.txt"
}

env {
  PYTHONNOUSERSITE = 1
  JAVA_TOOL_OPTIONS = "-Xlog:disable -Xlog:all=warning:stderr"
  NUMBA_CACHE_DIR = "./numba_cache_dir"
}
